{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    " \n",
    "   # Load the data from the pickle file\n",
    "with open(r'C:\\Users\\edi\\GitHub\\pinns_opf\\data\\processed\\data_node10.pickle', 'rb') as file:\n",
    "    loaded_data = pickle.load(file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['edge_index', 'edge_weight', 'features_seq', 'targets_seq'])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "loaded_data.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "targets_seq = np.array(loaded_data['targets_seq'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(23000, 10, 12)"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "targets_seq.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "noise = np.random.normal(loc=0.0, scale =0.08, size = targets_seq.shape)\n",
    "noise_2 = np.random.normal(loc=0.0, scale =0.5, size = targets_seq.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 0.04902481, -0.02162273,  0.08364913, ..., -0.0967749 ,\n",
       "         -0.1190669 ,  0.18614006],\n",
       "        [ 0.04443022,  0.06496431, -0.01682266, ...,  0.09341521,\n",
       "         -0.04263427,  0.0506511 ],\n",
       "        [-0.0248929 , -0.04204152,  0.03490042, ...,  0.11330467,\n",
       "         -0.02508412, -0.10102104],\n",
       "        ...,\n",
       "        [-0.14019211,  0.05576238,  0.02046444, ...,  0.00892353,\n",
       "         -0.119784  ,  0.11857994],\n",
       "        [-0.00697833,  0.03399692, -0.11887935, ..., -0.04949382,\n",
       "         -0.09724559,  0.03177306],\n",
       "        [-0.16167305,  0.12339438, -0.01993716, ...,  0.09019389,\n",
       "          0.01087004, -0.11441169]],\n",
       "\n",
       "       [[-0.1555827 , -0.11506832,  0.03972956, ...,  0.0049407 ,\n",
       "         -0.01274808,  0.06223893],\n",
       "        [ 0.03514338,  0.04499487,  0.10619159, ...,  0.00859381,\n",
       "         -0.10563266, -0.03895833],\n",
       "        [ 0.03417594,  0.00644277,  0.01720495, ..., -0.14638613,\n",
       "          0.03770841, -0.05434993],\n",
       "        ...,\n",
       "        [ 0.03427624, -0.1843045 ,  0.00837447, ..., -0.10176413,\n",
       "         -0.0028916 , -0.05978104],\n",
       "        [-0.16053444, -0.02420967,  0.03550862, ...,  0.07177553,\n",
       "         -0.03533954,  0.05037637],\n",
       "        [-0.0411982 ,  0.08974599, -0.06896531, ...,  0.02870678,\n",
       "          0.04031863, -0.07467287]],\n",
       "\n",
       "       [[-0.01639103,  0.10768405, -0.06457001, ..., -0.09939927,\n",
       "         -0.0143702 ,  0.07506869],\n",
       "        [ 0.24624811,  0.15019794, -0.14777003, ..., -0.05195658,\n",
       "         -0.02257335,  0.0965126 ],\n",
       "        [-0.01299573, -0.04240395,  0.10153316, ...,  0.07137443,\n",
       "          0.03327785, -0.03858342],\n",
       "        ...,\n",
       "        [ 0.04698433, -0.06312326, -0.00434035, ..., -0.03114264,\n",
       "          0.0304166 ,  0.12055831],\n",
       "        [ 0.01818916, -0.02175318,  0.02119447, ...,  0.13714753,\n",
       "         -0.04044325, -0.04468764],\n",
       "        [-0.11663746,  0.06396622,  0.0802458 , ...,  0.05963237,\n",
       "         -0.02759463,  0.1370098 ]],\n",
       "\n",
       "       ...,\n",
       "\n",
       "       [[ 0.1231527 ,  0.07965871, -0.02482134, ..., -0.00816784,\n",
       "         -0.15927942, -0.0174651 ],\n",
       "        [-0.04051081,  0.05054901,  0.03246706, ...,  0.01344283,\n",
       "         -0.0387525 , -0.07524376],\n",
       "        [ 0.11837794, -0.0693503 , -0.09012577, ...,  0.1405799 ,\n",
       "          0.08015017, -0.10514878],\n",
       "        ...,\n",
       "        [-0.02418944, -0.04780434,  0.10220832, ..., -0.03133897,\n",
       "          0.13763441, -0.10526934],\n",
       "        [-0.06414573,  0.07907105, -0.08524752, ...,  0.0621674 ,\n",
       "         -0.02534489, -0.15849893],\n",
       "        [ 0.05872471,  0.00657952, -0.12807756, ..., -0.07718199,\n",
       "         -0.05162269,  0.01974894]],\n",
       "\n",
       "       [[ 0.03866114, -0.04731766,  0.11546052, ...,  0.09232544,\n",
       "         -0.10818615,  0.04042645],\n",
       "        [ 0.07164703,  0.02110203, -0.05346244, ..., -0.02937949,\n",
       "          0.13337511,  0.03097883],\n",
       "        [-0.04562174,  0.00150586,  0.00437268, ..., -0.03592073,\n",
       "         -0.05868705, -0.02722971],\n",
       "        ...,\n",
       "        [ 0.0986886 ,  0.01749549,  0.06370688, ...,  0.11953743,\n",
       "         -0.11790728,  0.08842325],\n",
       "        [-0.18851329, -0.01605222, -0.03764793, ..., -0.0322583 ,\n",
       "         -0.07764343,  0.051672  ],\n",
       "        [ 0.17045871, -0.05795714, -0.09162985, ...,  0.12781011,\n",
       "          0.01750661,  0.00091052]],\n",
       "\n",
       "       [[-0.00860295, -0.07450426, -0.15282313, ..., -0.14673196,\n",
       "         -0.02404198, -0.12757409],\n",
       "        [ 0.04558389,  0.09134145,  0.18695242, ..., -0.02597353,\n",
       "         -0.02994349, -0.06930159],\n",
       "        [-0.12253704, -0.07848289,  0.01581696, ..., -0.19540764,\n",
       "          0.06837895,  0.13835768],\n",
       "        ...,\n",
       "        [ 0.02996102,  0.01142928, -0.08772109, ...,  0.05065738,\n",
       "          0.09736892, -0.03042385],\n",
       "        [ 0.08413488,  0.05384154, -0.09195505, ..., -0.02016877,\n",
       "          0.02176346,  0.02910575],\n",
       "        [ 0.08622138, -0.00241358, -0.01076355, ...,  0.02342889,\n",
       "         -0.03551231,  0.07659186]]])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "noise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "targets_seq_noise = targets_seq + noise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "targets_seq_noise_2 = targets_seq + noise_2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "# loaded_data['targets_seq'] = targets_seq_noise\n",
    "# # Save the data as a pickle file\n",
    "# with open(r'C:\\Users\\edi\\GitHub\\pinns_opf\\data\\processed\\data_converged_noise3.pickle', 'wb') as file:\n",
    "#         pickle.dump(loaded_data, file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "loaded_data['targets_seq'] = targets_seq_noise_2\n",
    "# Save the data as a pickle file\n",
    "with open(r'C:\\Users\\edi\\GitHub\\pinns_opf\\data\\processed\\data_node10.pickle', 'wb') as file:\n",
    "        pickle.dump(loaded_data, file)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pinns_opf",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.17"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
